﻿namespace WenAntdUI.Helps
{
    public static class VersionHelp
    {
        public static string GetVersionString()
        {
            return $"{Version?.Major}.{Version?.Minor}";
        }

        public static string AppendVersion(this Control control)
        {
            var text = control.Text + " V." + GetVersionString();
            control.Text = text;
            return text;
        }

        public static Version Version => System.Reflection.Assembly.GetExecutingAssembly()?.GetName()?.Version;

        public static string GetVersionString(this System.Reflection.Assembly assembly)
        {
            var version = assembly?.GetName()?.Version;
            return version == null ? "" : $"{version.Major}.{version.Minor}.{version.Build}";
        }
    }
}
